package com.ssy.lingxi.order.repository;

import com.ssy.lingxi.order.entity.OrderDO;
import com.ssy.lingxi.order.entity.OrderDeliveryDO;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 订单发货记录Jpa仓库
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-17
 */
@Repository
public interface OrderDeliveryRepository extends JpaRepository<OrderDeliveryDO, Long>, JpaSpecificationExecutor<OrderDeliveryDO> {
    List<OrderDeliveryDO> findByOrder(OrderDO order, Sort sort);

    List<OrderDeliveryDO> findByOrder(OrderDO order);

    OrderDeliveryDO findFirstByOrderAndBatchNo(OrderDO order, Integer batchNo);

    OrderDeliveryDO findFirstByOrderIdAndBatchNo(Long orderId, Integer batchNo);

    List<OrderDeliveryDO> findByDeliveryNo(String deliveryNo);

    List<OrderDeliveryDO> findByDeliveryNoAndBuyerInnerStatus(String deliveryNo, Integer buyerInnerStatus);
}
